package com.aaa.service.yy.impl;

import com.aaa.dao.yy.PlanSdsDao;
import com.aaa.pojo.yy.PlanSds;
import com.aaa.service.yy.PlanSdsService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PlanSdsServiceImpl implements PlanSdsService {
    @Autowired
    private PlanSdsDao planSdsDao;

/*    @Override
    public List<PlanSds> findAllPlan() {
        List<PlanSds> allPlan = planSdsDao.findAllPlan();
       return allPlan;
    }*/

    @Override
    public List<PlanSds> findAllPlan(String page, String limit) {
        int pageInt = Integer.parseInt(page);
        int limitInt = Integer.parseInt(limit);
        int start = (pageInt - 1)*limitInt;
        List<PlanSds> allPlan = planSdsDao.findAllPlan(start, limitInt);
        return allPlan;
    }

    @Override

    public int findCount() {
        int count = planSdsDao.findCount();
        return count;
    }

    @Override
    public int insert(PlanSds planSds) {
        int insert = planSdsDao.insert(planSds);
        return insert;
    }

    @Override
    public int update(PlanSds planSds) {
        int update = planSdsDao.update(planSds);
        return update;
    }

    @Override
    public int delete(@Param("idList") List idList) {
        int delete = planSdsDao.delete(idList);
        return delete;
    }

    @Override
    public List<PlanSds> planFuzzyQuestionAndCreatBy(String testName, String createBy) {
        List<PlanSds> planSds = planSdsDao.planFuzzyQuestionAndCreatBy(testName, createBy);
        return planSds;
    }
}
